<template>
	<view>
		<view class="top">个人信息</view>
		<view class="items" v-for="(item,index) in personal_information" :key="index">
			<view class="item_one">
				<view class="item_one_information">
					<span>头像</span>
				</view>
				<view class="item_one_img">
					<img src="/static/images/avatar.png" class="item_one_img_right">
				</view>
			</view>
			<view class="item">
				<span class='qq'>姓名</span>
				<input class="qqq" type="text" style="text-align: right;" v-model="item.name">
			</view>

			<view class="item">
				<span class='qq'>性别</span>
				<input class="qqq" type="text" style="text-align: right;" v-model="item.sex">
			</view>
			<view class="item">
				<span class='qq'>绑定手机号</span>
				<input class="qqq" type="text" style="text-align: right;" v-model="item.phone">
			</view>
			<view class="item">
				<span class='qq'>店铺名称</span>
				<input class="qqq" type="text" style="text-align: right;" v-model="item.shop_name">
			</view>
			<view class="item">
				<span class='qq'>店铺地址</span>
				<input class="qqq" type="text" style="text-align: right;" v-model="item.shop_location">
			</view>
			<view class="item">
				<span class='qq'>角色权限</span>
				<input class="qqq" type="text" style="text-align: right;" :value="item.authority">
			</view>
		</view>
		<view class="bottom_save" @click="tz_my_fn">
			<view class="save">
				保存
			</view>
		</view>
		<view class="bottom_quit" @click="quit_fn()">
			<view class="quit">
				退出登录
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				personal_information: [],
				fuzhi_list: [],
				// yiqian_name: '',
				qa: '',
				qb: '',
				qc: '',
				qd: '',
				qe: '',
				qf: ''
			}
		},

		mounted() {

		},
		onLoad() {
			uni.request({
				url: 'http://localhost:3000/information', //仅为示例，并非真实接口地址。
				success: (res) => {
					// console.log(res.data.data);
					this.personal_information = res.data.data
					console.log(this.personal_information);
					// this.yiqian_name = this.personal_information[0].name;
					this.diao()
				}
			});
		},
		methods: {
			diao() {
				// #ifdef APP-NVUE
				const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
				// #endif
				// #ifndef APP-NVUE
				const eventChannel = this.getOpenerEventChannel();
				// #endif
				eventChannel.emit('sx', {
					xxx: this.personal_information
				});
			},
			tz_my_fn() {
				console.log(this.personal_information);
				uni.request({
					url: 'http://localhost:3000/information_update', //仅为示例，并非真实接口地址。
					data: {
						xxx: this.personal_information[0],
						// dsx: this.yiqian_name
					},
					success: (res) => {
						console.log(res.data);
					}
				});
				uni.navigateBack({})

			},
			quit_fn() {

			}
		}
	}
</script>
<style>
	@import './Personal_information.css'
</style>
